﻿<!DOCTYPE html>
<!-- saved from url=(0093)http://www.codeproject.com/Articles/302012/How-to-Build-libiconv-with-Microsoft-Visual-Studio -->
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>How to Build libiconv with Microsoft Visual Studio - CodeProject</title> 
	<link type="text/css" rel="stylesheet" href="./How to Build libiconv with Microsoft Visual Studio_files/Main.min.css">

	

<meta name="Description" content="The GNU library libiconv does not provide the way to build the library with Microsoft Visual Studio now. But, I want to share my way to do so; Author: PARK Youngho; Updated: 21 Dec 2011; Section: Libraries; Chapter: Platforms, Frameworks &amp; Libraries; Updated: 21 Dec 2011">
<meta name="Keywords" content="C++, Windows, Intermediate,Libraries,Platforms, Frameworks &amp; Libraries,Free source code, tutorials">
<meta name="Author" content="PARK Youngho">
<meta name="Rating" content="General">
<meta name="Revisit-After" content="1 days">
<meta name="application-name" content="CodeProject">


<style>
    body{
        margin-left: 20px;
        margin-right: 20px;
    }
</style>
	



<body class="chrome chrome45">



    <div class="header">
        <a name="Main"></a>

        <a name="_articleTop" id="_articleTop"></a>
        <div class="title">

            <h1 id="ctl00_ArticleTitle" itemprop="name">How to Build libiconv with Microsoft Visual Studio</h1>
        </div>
        <div style="height:34px">

            <div class="entry float-left">
                <img src="./How to Build libiconv with Microsoft Visual Studio_files/{DEA78F6F-2E34-4396-8F0F-DA856D1980C0}.jpg" id="ctl00_avatar" class="float-left avatar">
                <div class="float-left">
                    <span class="author"><a href="http://www.codeproject.com/script/Membership/View.aspx?mid=3279933" rel="author"><span itemprop="author" itemscope="" itemtype="http://schema.org/Person"><span itemprop="name">PARK Youngho</span></span></a></span>,
                    <span class="date" itemprop="dateModified" title="Date last updated" content="2011-12-21 11:14:00">
                        21 Dec 2011
                    </span>

                    <a id="ctl00_LicenseLink" title="The GNU Lesser General Public License (LGPLv3)" class="license" href="http://www.opensource.org/licenses/lgpl-3.0.html">LGPL3</a><div id="ctl00_CurRat" class="tooltip anchorLink" style="cursor:pointer;margin-top: 5px" name="CurRat_302012">


                        <table cellpadding="0" cellspacing="0" class="small-text" itemprop="aggregateRating" itemscope="" itemtype="http://schema.org/AggregateRating">
                            <tbody>
                                <tr>

                                    <td class="nowrap">

                                        <meta itemprop="bestRating" content="5">
                                        <meta itemprop="worstRating" content="1">

                                        <span id="ctl00_ArticleRating_VI">
                                            <div class="nowrap rating-stars-medium" style="height:18px;width:80px;position:relative;">
                                                <div class="clipped align-left float-left" style="height:16px;width:77px;">
                                                    <img src="./How to Build libiconv with Microsoft Visual Studio_files/stars-fill-md.png" style="border-width:0px;">
                                                </div><div class="clipped" style="height:16px;width:3px;position:relative;">
                                                    <img src="./How to Build libiconv with Microsoft Visual Studio_files/stars-empty-md.png" style="border-width:0px;position:absolute;top:0;right:0;">
                                                </div>
                                            </div>
                                        </span>

                                    </td>

                                    <td id="ctl00_ArticleRating_VR" class="nowrap">
                                        &nbsp;
                                        <span id="ctl00_ArticleRating_VotesR">&nbsp;<span itemprop="ratingValue" class="rating">4.83</span> (<span itemprop="ratingCount" class="count">28</span> votes)</span>

                                    </td>
                                </tr>
                            </tbody>
                        </table>

                        <div id="ctl00_RB" class="speech-bubble-container-up">
                            <div class="speech-bubble-up" style="width:150px !important">

                                <div>
                                    <table class="feature" width="100%" height="50px" title="Voting Distribution. Recent data only" cellpadding="0" cellspacing="0">
                                        <tbody>
                                            <tr class="chart-row">
                                                <td class="chart-column"><div class="rating-ignore-vote" title="Votes not included in score."><img src="./How to Build libiconv with Microsoft Visual Studio_files/pollcol.gif" width="20pxpx" height="2px" border="0px" alt="1 vote, 3.7%" title="1 vote, 3.7%"></div><span title="0 votes">1</span></td>
                                                <td class="chart-column"><span title="0 votes">2</span></td>
                                                <td class="chart-column"><span title="0 votes">3</span></td>
                                                <td class="chart-column"><div><img src="./How to Build libiconv with Microsoft Visual Studio_files/pollcol.gif" width="20pxpx" height="6px" border="0px" alt="3 votes, 11.1%" title="3 votes, 11.1%"></div><span title="3 votes">4</span></td>
                                                <td class="chart-column"><div><img src="./How to Build libiconv with Microsoft Visual Studio_files/pollcol.gif" width="20pxpx" height="50px" border="0px" alt="24 votes, 88.9%" title="24 votes, 88.9%"></div><span title="24 votes">5</span></td>
                                            </tr>
                                        </tbody>
                                    </table><div class="small-text align-center">4.83/5 - 28 votes</div><div class="small-text align-center subdue">1 removed</div><div class="small-text align-center subdue">μ 4.74, σ<sub>a</sub> 1.20 [<a href="http://www.codeproject.com/KB/FAQs/RatingReputationFAQ.aspx#noisefilter">?</a>]</div>
                                </div>
                            </div>
                            <div class="speech-bubble-pointer-up">
                                <div class="speech-bubble-pointer-up-inner"></div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div id="ctl00_RateArticleRow" class="float-right align-right voting-bar">
                <div id="ctl00_RateArticle_RateItemWrapper" class="container-rating small-text" name="RateItem_302012">
                    <table width="100%" cellpadding="0" cellspacing="0" class="small-text">
                        <tbody>
                            <tr>
                                <td id="ctl00_RateArticle_VoteResultDiv" class="rating-result align-right">
                                    <span class="align-right"></span>
                                    <img class="loaderImg" width="16px" alt="loading..." height="16px" src="./How to Build libiconv with Microsoft Visual Studio_files/animated_loading_blue.gif" style="display:none;">
                                </td>

                                <td class="voteTbl" style="white-space:nowrap" align="right">
                                    <table class="small-text">
                                        <tbody>
                                            <tr>
                                                <td id="ctl00_RateArticle_RateText" class="rating-prompt">
                                                    Rate this:
                                                </td>

                                                <td id="ctl00_RateArticle_VoteFormDiv" class="nowrap rating-stars-voter-large">

                                                    <span id="ctl00_RateArticle_RB" class="tooltip ajaxHist radio voting">
                                                        <span id="ctl00_RateArticle_VoteRBL"><input id="ctl00_RateArticle_VoteRBL_0" type="radio" name="ctl00$RateArticle$VoteRBL" value="1"><input id="ctl00_RateArticle_VoteRBL_1" type="radio" name="ctl00$RateArticle$VoteRBL" value="2"><input id="ctl00_RateArticle_VoteRBL_2" type="radio" name="ctl00$RateArticle$VoteRBL" value="3"><input id="ctl00_RateArticle_VoteRBL_3" type="radio" name="ctl00$RateArticle$VoteRBL" value="4"><input id="ctl00_RateArticle_VoteRBL_4" type="radio" name="ctl00$RateArticle$VoteRBL" value="5"></span>

                                                    </span>
                                                </td>

                                                <td style="padding-left:5px">
                                                    <input type="submit" name="ctl00$RateArticle$SubmitRateBtn" value="Vote!" id="ctl00_RateArticle_SubmitRateBtn" class="button">
                                                </td>
                                            </tr>
                                        </tbody>
                                    </table>

                                </td>
                            </tr>
                        </tbody>
                    </table>
                    <div class="hover-container">

                        <div id="ctl00_RateArticle_RSU" class="rating-comment align-left float-right">
                            <div class="padded">
                                Please <a id="ctl00_RateArticle_SignUp" href="https://www.codeproject.com/script/Membership/LogOn.aspx?rp=%2fArticles%2f302012%2fHow-to-Build-libiconv-with-Microsoft-Visual-Studio">Sign up or sign in</a> to vote.
                            </div>
                        </div>
                    </div>
                </div>
            </div>

        </div>

        <div id="ctl00_description" class="summary" itemprop="headline">The GNU library libiconv does not provide the way to build the library with Microsoft Visual Studio now. But, I want to share my way to do so</div><span id="ctl00_thumbnailUrl" class="date" itemprop="image" content="http://www.codeproject.com/KB/library/Buildlibiconv/Thumb-302012.gif"></span>
    </div>











    <div id="contentdiv" class="text" itemprop="articleBody">


        <ul class="download">
            <li><a href="http://www.codeproject.com/KB/library/Buildlibiconv/HowToBuildLibiconv_Src.zip">Download source - 1.13 MB</a> </li>
            <li><a href="http://www.codeproject.com/KB/library/Buildlibiconv/HowToBuildLibiconv_Demo.zip">Download demo - 5.36 MB</a> </li>
        </ul>
        <h2>Introduction</h2>
        <p><code>Libiconv </code>is one of the most useful and famous libraries that converts texts between encodings and has been developed under GNU projects. However, now it does not provide the way to build it with Microsoft Visual Studio but with gcc. Before, it had provided but now stopped explaining how to build it with Microsoft Visual Studio. However, many of the computer programmers are using Microsoft Visual Studio and want to build <code>libiconv </code>with Microsoft Visual Studio. So, this article is about how to build <code>libiconv </code>with Microsoft Visual Studio. If you can build <code>libiconv </code>with Microsoft Visual Studio, you will be able to change various compilation options and build it in order to optimize <code>libiconv </code>according to your preference and needs.</p>
        <h2>Background</h2>
        <p>If you have no idea about <code>libiconv</code>, you can refer to it&nbsp;<a href="http://www.gnu.org/s/libiconv/">here</a> or you can Google for it. You may be confused with <code>iconv </code>and <code>libiconv</code>. <code>Iconv </code>is the executable program that uses <code>libiconv </code>while <code>libiconv </code>is the library for converting text strings between two different encodings. This article is related to <code>libiconv</code>. However, this article is not about <code>libiconv </code>but about how to build <code>libiconv </code>with Microsoft Visual Studio. The GNU library <code>libiconv </code>is under LGPL license. So, you have to be really careful when you use <code>libiconv </code>for your commercial use or when you don't want to publicize your source code. About LPGL license, you can refer <a href="http://www.gnu.org/licenses/lgpl.html">here</a>.</p>
        <h2>How to Get the Source Code of libiconv </h2>
        <p>At the moment, the most recent version of <code>libiconv </code>is 1.14. You can download the source code of <code>libiconv </code>1.14 <a href="http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz">here</a> and <a href="http://ftp.gnu.org/gnu/libiconv/">here</a>. Of course, you can get the older versions of <code>libiconv </code><a href="http://ftp.gnu.org/gnu/libiconv/">here</a>.</p>
        <h2>How to Build</h2>
        <p>I am going to explain the case of Microsoft Visual Studio 2010 professional edition but the explanation can be applied to the earlier versions of Microsoft Visual Studio and to the express edition of each of them.</p>
        <h3>First Step</h3>
        <p>You download the most recent version of <code>libiconv </code>which is 1.14 from <a href="http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz">here</a> or <a href="http://ftp.gnu.org/gnu/libiconv/">here</a>. And unzip the downloaded file "<em>libiconv-1.14.tar.gz</em>" on your certain folder.</p>
        <h3>Second Step</h3>
        <p>You run your Microsoft Visual Studio. Then, you make a new <code>WIN32 </code>project. Let's say "<code>libiconv</code>" as the project name. Check to create directory for solution. Choose DLL as the application type and check Empty project for additional options. Click the button "finish" to generate the new project.</p>
        <p><img style="WIDTH: 640px; HEIGHT: 360px" border="0" hspace="0" src="./How to Build libiconv with Microsoft Visual Studio_files/HowToBuildLibiconv1.gif" width="640" height="360"></p>
        <p><img style="WIDTH: 625px; HEIGHT: 530px" border="0" hspace="0" src="./How to Build libiconv with Microsoft Visual Studio_files/HowToBuildLibiconv2.gif" width="625" height="530"></p>
        <h3>Third Step</h3>
        <p>Now, you have to copy some files from the folders generated by unzipping "<em>libiconv-1.14.tar.gz</em>" to the project folders. To build "<code>libiconv</code>", you need to compile three files "<em>localcharset.c</em>", "<em>relocatable.c</em>" and "<em>iconv.c</em>". That is the key idea!</p>
        <p>Copy three files "<em>relocatable.h</em>", "<em>relocatable.c</em>" and "<em>iconv.c</em>" in the folder "<em>...\libiconv-1.14\lib\</em>" to the project folder "<em>...\libiconv\libiconv\</em>".<br>Copy "<em>...\libiconv-1.14\libcharset\lib\localcharset.c</em>" to the project folder "<em>...\libiconv\libiconv\</em>".<br>Copy "<em>...\libiconv-1.14\libcharset\include\localcharset.h.build.in</em>" to the project folder "<em>...\libiconv\libiconv\</em>" and then, rename the copied "<em>localcharset.h.build.in</em>" to "<em>localcharset.h</em>.<br>Copy "<em>...\libiconv-1.14\windows\libiconv.rc</em>" to the project folder "<em>...\libiconv\libiconv\</em>".</p>
        <p>Make folder "<em>include</em>" under the project folder "...\libiconv\" so to make "<em>...\libiconv\include</em>". <br>Copy "<em>...\libiconv-1.14\include\iconv.h.build.in</em>" to the project include folder "<em>...\libiconv\include</em>" and then, rename the copied "<em>iconv.h.build.in</em>" to "<em>iconv.h</em>".<br>Copy "<em>...\libiconv-1.14\config.h.in</em>" to the project include folder "<em>...\libiconv\include</em>" and then, rename the copied "<em>config.h.in</em>" to "<em>config.h</em>".<br>And then, copy all the header files (<em>*.h</em>) and definition files (<em>*.def</em>) in the folder "<em>...\libiconv-1.14\lib</em>" to the project include folder "<em>...\libiconv\include</em>".</p>
        <h3>Fourth Step</h3>
        <p>Now, you have to add existing items to the project "<code>libiconv</code>" that we made at the second step. Execute "project &gt; Add Existing items..." at the main menu to add existing items to the project.</p>
        <p><img style="WIDTH: 640px; HEIGHT: 451px" border="0" hspace="0" src="./How to Build libiconv with Microsoft Visual Studio_files/HowToBuildLibiconv3.gif" width="640" height="451"></p>
        <h3>Fifth Step</h3>
        <p>You can make 64-bit platform through configuration manager in order to generate <em>libiconv.dll</em> for 64-bit system. You can also make two other configurations "<code>ReleaseStatic</code>" and "<code>DebugStatic</code>" in order to generate <code>libiconvStatic.lib </code>as a static link library.</p>
        <p>At the project properties, change Output Directory as "<em>$(SolutionDir)$(Configuration)_$(Platform)\</em>" and Intermediate Directory as "<em>$(SolutionDir)obj\$(ProjectName)\$(Configuration)_$(Platform)\</em>".</p>
        <p><img style="WIDTH: 640px; HEIGHT: 450px" border="0" hspace="0" src="./How to Build libiconv with Microsoft Visual Studio_files/HowToBuildLibiconv4.gif" width="640" height="450"></p>
        <p>Change Include Directories as "<em>..\include;$(IncludePath)</em>": </p>
        <p><img style="WIDTH: 640px; HEIGHT: 450px" border="0" hspace="0" src="./How to Build libiconv with Microsoft Visual Studio_files/HowToBuildLibiconv5.gif" width="640" height="450"></p>
        <p>You have to add "<code>BUILDING_LIBICONV</code>" and "<code>BUILDING_LIBCHARSET</code>" to Peprocessor Definitions of all Platforms and of all configurations.</p>
        <p><img style="WIDTH: 640px; HEIGHT: 450px" border="0" hspace="0" src="./How to Build libiconv with Microsoft Visual Studio_files/HowToBuildLibiconv6.gif" width="640" height="450"></p>
        <p>You'd better set Runtime Library to "Multi-threaded" when building dynamic link library <em>libiconv.dll</em>. Then, the dependency on VC Runtime library can be controlled by the applications that will be built and dynamically linked with <em>libiconv.dll</em> because <em>libiconv.dll</em> does not need VC Runtime library but only the application that uses <em>libiconv.dll</em> may or may not need VC Runtime library. However, when building the <code>static </code>link library <em>libiconvStatic.lib</em>, you can choose Runtime Library option for <em>libiconvStatic.lib</em> depending on the application that uses <em>libiconvStatic.lib</em>.</p>
        <p><img style="WIDTH: 640px; HEIGHT: 450px" border="0" hspace="0" src="./How to Build libiconv with Microsoft Visual Studio_files/HowToBuildLibiconv7.gif" width="640" height="450"></p>
        <p>You have to change Precompiled Header option to "Not Using Precompiled Headers".</p>
        <p><img style="WIDTH: 640px; HEIGHT: 450px" border="0" hspace="0" src="./How to Build libiconv with Microsoft Visual Studio_files/HowToBuildLibiconv8.gif" width="640" height="450"></p>
        <h3>Sixth Step</h3>
        <p>Now, it is the time to tweak the source code of the <code>libiconv</code>.</p>
        <h4>libiconv.rc</h4>
        <p>Open <em>libiconv.rc</em> with text editor or the source code editor of Visual Studio IDE by double-clicking <em>libiconv.rc</em> in the Solution explorer and insert some code at line 4 as follows:</p>
<pre lang="C++"><span class="code-summarycomment">///</span><span class="code-comment">////////////////////// 추가 / ADD / ДОВАВЛЯТЬ //////////////////////
</span><span class="code-preprocessor">#define PACKAGE_VERSION_MAJOR       1
</span><span class="code-preprocessor">#define PACKAGE_VERSION_MINOR       14
</span><span class="code-preprocessor">#define PACKAGE_VERSION_SUBMINOR    0
</span><span class="code-preprocessor">#define PACKAGE_VERSION_STRING      "1.14"
</span><span class="code-summarycomment">///</span><span class="code-comment">/////////////////////////////////////////////////////////////////////////////</span></pre>
        <p>You may be asked to change Line endings to "Windows (CR LF)". Then, let it do so. It will be more convenient for you if you mainly use Windows.</p>
        <h4>localcharset.c</h4>
        <p>Open <em>localcharset.c</em> and delete or comment the lines 76 - 79 as follows:</p>
<pre lang="C++"><span class="code-summarycomment">///</span><span class="code-comment">////////////////////// 삭제 / DELETE / удалить ///////////////////////
</span><span class="code-summarycomment">///</span><span class="code-comment">* Get LIBDIR.  */
</span><span class="code-comment">//</span><span class="code-comment">#ifndef LIBDIR
</span><span class="code-comment">//</span><span class="code-comment"># include "configmake.h"
</span><span class="code-comment">//</span><span class="code-comment">#endif
</span><span class="code-summarycomment">///</span><span class="code-comment">/////////////////////////////////////////////////////////////////////////////</span></pre>
        <h4>iconv.c</h4>
        <p>Open <em>iconv.c</em> and delete or comment the lines 246 - 248 and add three lines there as follows:</p>
<pre lang="C++"><span class="code-summarycomment">///</span><span class="code-comment">////////////////////// 삭제 / DELETE / УДАЛИТЬ ///////////////////////
</span><span class="code-comment">//</span><span class="code-comment">size_t iconv (iconv_t icd,
</span><span class="code-comment">//</span><span class="code-comment">              ICONV_CONST char* * inbuf, size_t *inbytesleft,
</span><span class="code-comment">//</span><span class="code-comment">              char* * outbuf, size_t *outbytesleft)
</span><span class="code-summarycomment">///</span><span class="code-comment">////////////////////// ?? / ADD / ????????? //////////////////////
</span><span class="code-sdkkeyword">size_t</span> iconv (iconv_t icd,
        <span class="code-keyword">const</span> <span class="code-keyword">char</span>* * inbuf, <span class="code-sdkkeyword">size_t</span> *inbytesleft,
        <span class="code-keyword">char</span>* * outbuf, <span class="code-sdkkeyword">size_t</span> *outbytesleft)
<span class="code-summarycomment">///</span><span class="code-comment">/////////////////////////////////////////////////////////////////////////////</span></pre>
        <h4>localcharset.h</h4>
        <p>Open <em>localcharset.h</em> and delete or comment the lines 23 - 27 and add 7 lines there as follows:</p>
<pre lang="C++"><span class="code-summarycomment">///</span><span class="code-comment">////////////////////// 삭제 / DELETE / УДАЛИТЬ ///////////////////////
</span><span class="code-comment">//</span><span class="code-comment">#if @HAVE_VISIBILITY@ &amp;&amp; BUILDING_LIBCHARSET
</span><span class="code-comment">//</span><span class="code-comment">#define LIBCHARSET_DLL_EXPORTED __attribute__((__visibility__("default")))
</span><span class="code-comment">//</span><span class="code-comment">#else
</span><span class="code-comment">//</span><span class="code-comment">#define LIBCHARSET_DLL_EXPORTED
</span><span class="code-comment">//</span><span class="code-comment">#endif
</span><span class="code-summarycomment">///</span><span class="code-comment">////////////////////// ?? / ADD / ????????? //////////////////////
</span><span class="code-preprocessor">#ifdef BUILDING_LIBCHARSET
</span><span class="code-preprocessor">#define LIBCHARSET_DLL_EXPORTED __declspec(dllexport)
</span><span class="code-preprocessor">#elif USING_STATIC_LIBICONV
</span><span class="code-preprocessor">#define LIBCHARSET_DLL_EXPORTED
</span><span class="code-preprocessor">#else
</span><span class="code-preprocessor">#define LIBCHARSET_DLL_EXPORTED __declspec(dllimport)
</span><span class="code-preprocessor">#endif
</span><span class="code-summarycomment">///</span><span class="code-comment">/////////////////////////////////////////////////////////////////////////////</span></pre>
        <h4>config.h</h4>
        <p>Open <em>config.h</em> in the project include folder "<em>...\libiconv\include</em>" and delete or comment the lines 29 - 30 as follows:</p>
<pre lang="C++"><span class="code-summarycomment">///</span><span class="code-comment">////////////////////// 삭제 / DELETE / УДАЛИТЬ ///////////////////////
</span><span class="code-summarycomment">///</span><span class="code-comment">* Define as good substitute value for EILSEQ. */
</span><span class="code-comment">//</span><span class="code-comment">#undef EILSEQ
</span><span class="code-summarycomment">///</span><span class="code-comment">/////////////////////////////////////////////////////////////////////////////</span></pre>
        <p>Otherwise you can redefine <code>EILSEQ </code>as good substitute value.</p>
        <h4>iconv.h</h4>
        <p>Open <em>iconv.h</em> in the project include folder "<em>...\libiconv\include</em>" and delete or comment the line 175 and add 1 line as follows:</p>
<pre lang="C++"><span class="code-summarycomment">///</span><span class="code-comment">////////////////////// 삭제 / DELETE / УДАЛИТЬ ///////////////////////
</span><span class="code-comment">//</span><span class="code-comment">#if @HAVE_WCHAR_T@
</span><span class="code-summarycomment">///</span><span class="code-comment">////////////////////// 추가 / ADD / ДОВАВЛЯТЬ //////////////////////
</span><span class="code-preprocessor">#if HAVE_WCHAR_T
</span><span class="code-summarycomment">///</span><span class="code-comment">/////////////////////////////////////////////////////////////////////////////</span></pre>
        <p>Delete or comment the line 128 and add 1 line as follows:</p>
<pre lang="C++"><span class="code-summarycomment">///</span><span class="code-comment">////////////////////// 삭제 / DELETE / УДАЛИТЬ ///////////////////////
</span><span class="code-comment">//</span><span class="code-comment">#if @USE_MBSTATE_T@
</span><span class="code-summarycomment">///</span><span class="code-comment">////////////////////// 추가 / ADD / ДОВАВЛЯТЬ //////////////////////
</span><span class="code-preprocessor">#if USE_MBSTATE_T
</span><span class="code-summarycomment">///</span><span class="code-comment">/////////////////////////////////////////////////////////////////////////////</span></pre>
        <p>Delete or comment the lines 107-108 and add 2 lines as follows:</p>
<pre lang="C++"><span class="code-summarycomment">///</span><span class="code-comment">////////////////////// 삭제 / DELETE / УДАЛИТЬ ///////////////////////
</span><span class="code-comment">//</span><span class="code-comment">#if @USE_MBSTATE_T@
</span><span class="code-comment">//</span><span class="code-comment">#if @BROKEN_WCHAR_H@
</span><span class="code-summarycomment">///</span><span class="code-comment">////////////////////// 추가 / ADD / ДОВАВЛЯТЬ //////////////////////
</span><span class="code-preprocessor">#if USE_MBSTATE_T
</span><span class="code-preprocessor">#if BROKEN_WCHAR_H
</span><span class="code-summarycomment">///</span><span class="code-comment">/////////////////////////////////////////////////////////////////////////////</span></pre>
        <p>Delete or comment the line 89 and add 2 lines as follows:</p>
<pre lang="C++"><span class="code-summarycomment">///</span><span class="code-comment">////////////////////// 삭제 / DELETE / УДАЛИТЬ ///////////////////////
</span><span class="code-comment">//</span><span class="code-comment">extern LIBICONV_DLL_EXPORTED size_t iconv (iconv_t cd, @ICONV_CONST@ char* * inbuf, 
</span><span class="code-comment">//</span><span class="code-comment">size_t *inbytesleft, char* * outbuf, size_t *outbytesleft);
</span><span class="code-summarycomment">///</span><span class="code-comment">////////////////////// 추가 / ADD / ДОВАВЛЯТЬ //////////////////////
</span><span class="code-keyword">extern</span> LIBICONV_DLL_EXPORTED <span class="code-sdkkeyword">size_t</span> iconv (iconv_t cd, <span class="code-keyword">const</span> <span class="code-keyword">char</span>* * inbuf, 
        <span class="code-sdkkeyword">size_t</span> *inbytesleft, <span class="code-keyword">char</span>* * outbuf, <span class="code-sdkkeyword">size_t</span> *outbytesleft);
<span class="code-summarycomment">///</span><span class="code-comment">/////////////////////////////////////////////////////////////////////////////</span></pre>
        <p>Delete or comment the lines 26 - 31 and add 8 lines as follows:</p>
<pre lang="C++"><span class="code-summarycomment">///</span><span class="code-comment">////////////////////// 삭제 / DELETE / УДАЛИТЬ ///////////////////////
</span><span class="code-comment">//</span><span class="code-comment">#if @HAVE_VISIBILITY@ &amp;&amp; BUILDING_LIBICONV
</span><span class="code-comment">//</span><span class="code-comment">#define LIBICONV_DLL_EXPORTED __attribute__((__visibility__("default")))
</span><span class="code-comment">//</span><span class="code-comment">#else
</span><span class="code-comment">//</span><span class="code-comment">#define LIBICONV_DLL_EXPORTED
</span><span class="code-comment">//</span><span class="code-comment">#endif
</span><span class="code-comment">//</span><span class="code-comment">extern LIBICONV_DLL_EXPORTED @DLL_VARIABLE@ int _libiconv_version; /* Likewise */
</span><span class="code-summarycomment">///</span><span class="code-comment">////////////////////// 추가 / ADD / ДОВАВЛЯТЬ //////////////////////
</span><span class="code-preprocessor">#if BUILDING_LIBICONV
</span><span class="code-preprocessor">#define LIBICONV_DLL_EXPORTED __declspec(dllexport)
</span><span class="code-preprocessor">#elif USING_STATIC_LIBICONV
</span><span class="code-preprocessor">#define LIBICONV_DLL_EXPORTED
</span><span class="code-preprocessor">#else
</span><span class="code-preprocessor">#define LIBICONV_DLL_EXPORTED __declspec(dllimport)
</span><span class="code-preprocessor">#endif
</span><span class="code-keyword">extern</span> LIBICONV_DLL_EXPORTED <span class="code-keyword">int</span> _libiconv_version; <span class="code-comment">/*</span><span class="code-comment"> Likewise */</span>
<span class="code-summarycomment">///</span><span class="code-comment">/////////////////////////////////////////////////////////////////////////////</span></pre>
        <h2>How to Use</h2>
        <p>When you use newly built <code>libiconv</code>, the only header file that you need is <em>iconv.h</em>. You will need to link either the import library <em>libiconv.lib</em> or the <code>static </code>library <em>libiconvStatic.lib</em> in your project property or write the code in one of your source file as follows:</p>
<pre lang="C++"><span class="code-preprocessor">#pragma comment (lib, "libiconv.lib")
</span><span class="code-keyword">or</span>
<span class="code-preprocessor">#pragma comment (lib, "libiconvStatic.lib")</span></pre>
        <p>In the source of the application that uses this library either <em>libiconv.dll</em> or <em>libiconvStatic.lib</em>, if you don't define anything but only include <em>iconv.h</em>, your application will use <em>libiconv.dll</em> while it will use <em>libiconvStatic.lib</em> if you define <code>USING_STATIC_LIBICONV </code>before you include <em>iconv.h</em> in your application as follows:</p>
<pre lang="C++"><span class="code-comment">//</span><span class="code-comment">#define USING_STATIC_LIBICONV
</span><span class="code-keyword">#include</span><span class="code-preprocessor"> <span class="code-keyword">&lt;</span><span class="code-leadattribute">iconv.h</span><span class="code-keyword">&gt;</span></span></pre>
        <h2>Copyright Issues</h2>
        <p>The original <code>libiconv </code>is under LGPL licence. So, the tweaked <code>libiconv </code>has also to be under LGPL. If you develop any application that uses <code>libiconv</code>, you have to be careful about copyright issues. If your application is linked with <em>libiconv.dll</em> dynamically, you don't have to publicize your source code of your application. However, if your application is linked statically with <em>libiconvStatic.lib</em>, you have to publicize either the source code of the application or the object files (<em>*.obj</em>) of the application so that others can build the application that is linked statically with the library under LGPL license.</p>

    </div>




    <h2>License</h2>
    <div id="LicenseTerms"><p>This article, along with any associated source code and files, is licensed under <a href="http://www.opensource.org/licenses/lgpl-3.0.html" rel="license">The GNU Lesser General Public License (LGPLv3)</a></p></div>




</body></html>